//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
/**
 *
 *	@file		imageclip_data_ol.c
 *	@brief		イメージクリップセーブデータ GDS_COMMオーバーレイ
 *	@author		tomoya takahashi -> miyuki iwasawa
 *	@data		2006.02.27-2009.04.08
 *
 */
//]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
#include "common.h"
#include "include/savedata/savedata_def.h"	//SAVEDATA参照のため
#include "include/savedata/savedata.h"
#include "include/gflib/system.h"
#include "include/gflib/assert.h"
#include <string.h>

#define	__IMAGECLIP_DATA_H_GLOBAL
#include "include/savedata/imageclip_data.h"


#include "include/gflib/strbuf_family.h"
#include "imageclip_data_local.h"

//==============================================================================
//	GT_DRESS
//==============================================================================
#include "application/battle_recorder/gds_dressup.h"

//--------------------------------------------------------------
/**
 * @brief   ドレスアップデータをGTドレスアップ形式に変換する
 *
 * @param   dress			元データとなるドレスアップデータ
 * @param   gt_dress		変換後のデータセット先
 */
//--------------------------------------------------------------
void ImcTelevision_to_GTDress(const IMC_TELEVISION_SAVEDATA * dress, GT_GDS_DRESS * gt_dress)
{
	int i;

	MI_CpuClear8(gt_dress, sizeof(GT_GDS_DRESS));

//	MI_CpuCopy8(dress, gt_dress, ImcSaveData_GetTelevisionWorkSize());
	gt_dress->init_flag = dress->init_flag;
	//gt_dress->pokemon = dress->pokemon;
	{
		gt_dress->pokemon.personal_rnd = dress->pokemon.personal_rnd;
		gt_dress->pokemon.idno = dress->pokemon.idno;
		gt_dress->pokemon.monsno = dress->pokemon.monsno;
		for(i = 0; i < GT_IMC_SAVEDATA_OYANAME_STR_NUM; i++){
			gt_dress->pokemon.oyaname[i] = dress->pokemon.oyaname[i];
		}
		gt_dress->pokemon.poke_pri = dress->pokemon.poke_pri;
		gt_dress->pokemon.poke_x = dress->pokemon.poke_x;
		gt_dress->pokemon.poke_y = dress->pokemon.poke_y;
		gt_dress->pokemon.form_id = dress->pokemon.form_id;
	}
	gt_dress->accessory_set_msk = dress->accessory_set_msk;
	gt_dress->title = *((GT_PMS_DATA*)(&dress->title));
	for(i = 0; i < GT_IMC_SAVEDATA_TELEVISION_ACCE_NUM; i++){
		gt_dress->acce[i] = *((GT_IMC_SAVEDATA_ACCESSORIE *)(&dress->acce[i]));
	}
	gt_dress->bg_id = dress->bg_id;
	gt_dress->country = dress->country;

	//チェックサム作成
//	gt_dress->crc.crc16ccitt_hash =
//		SaveData_CalcCRC(sv, gt_dress, sizeof(GT_GDS_DRESS) - GT_GDS_CRC_SIZE);
}

//--------------------------------------------------------------
/**
 * @brief   GTドレスアップをドレスアップ形式に変換する
 *
 * @param   gt_dress		元データとなるGTドレスアップデータ
 * @param   dress			変換後のデータセット先
 */
//--------------------------------------------------------------
void GTDress_to_ImcTelevision(const GT_GDS_DRESS * gt_dress, IMC_TELEVISION_SAVEDATA * dress)
{
	int tv_size;
	int i;

	tv_size = ImcSaveData_GetTelevisionWorkSize();

	MI_CpuClear8(dress, tv_size);

	dress->init_flag = gt_dress->init_flag;
	//dress->pokemon = gt_dress->pokemon;
	{
		dress->pokemon.personal_rnd = gt_dress->pokemon.personal_rnd;
		dress->pokemon.idno = gt_dress->pokemon.idno;
		dress->pokemon.monsno = gt_dress->pokemon.monsno;
		for(i = 0; i < IMC_SAVEDATA_OYANAME_STR_NUM; i++){
			dress->pokemon.oyaname[i] = gt_dress->pokemon.oyaname[i];
		}
		dress->pokemon.poke_pri = gt_dress->pokemon.poke_pri;
		dress->pokemon.poke_x = gt_dress->pokemon.poke_x;
		dress->pokemon.poke_y = gt_dress->pokemon.poke_y;
		dress->pokemon.form_id = gt_dress->pokemon.form_id;
	}
	dress->accessory_set_msk = gt_dress->accessory_set_msk;
	dress->title = *((PMS_DATA *)(&gt_dress->title));
	for(i = 0; i < GT_IMC_SAVEDATA_TELEVISION_ACCE_NUM; i++){
		dress->acce[i] = *((IMC_SAVEDATA_ACCESSORIE *)(&gt_dress->acce[i]));
	}
	dress->bg_id = gt_dress->bg_id;
	dress->country = gt_dress->country;

	//GT_GDS_DRESSには無いパラメータの初期値のセット
	for(i = 0; i < IMC_SAVEDATA_NICKNAME_STR_NUM; i++){
		dress->pokemon.nickname[i] = EOM_;
	}
	dress->pokemon.oya_sex = PM_MALE;
}


